package com.wontube.core.pub.servlet.handlers;

import java.sql.Connection;

import com.wontube.core.remote.IHandler;


/**
 * @author yuechao
 * 
 */
public final class HandlerConfig {
	private IHandler handler;
	private boolean isAutoTrans;
	private int transIsolation;

	/**
	 * @param autoDbSupported
	 * @param autoTransSupported
	 * 
	 */
	public HandlerConfig(IHandler handler, boolean isAutoTrans, int transIsolation) {
		this.handler = handler;

		this.isAutoTrans = isAutoTrans;
		this.transIsolation = transIsolation;
	}

	/**
	 * @param handler
	 * 
	 */
	public HandlerConfig(IHandler handler) {
		this(handler, true, Connection.TRANSACTION_READ_COMMITTED);
	}

	public IHandler getHandler() {
		return this.handler;
	}

	public void setHandler(IHandler handler) {
		this.handler = handler;
	}

	/**
	 * 获取是否启用事务
	 * 
	 * @return
	 */
	public boolean isAutoTrans() {
		return this.isAutoTrans;
	}

	public int getTransIsolation() {
		return this.transIsolation;
	}
}
